#!.//common/bats/bin/bats 
# -*-sh-*-

source ./common/test_helper_functions.bash || exit 1
source ./common/functions || exit 1

if [ -s ./common/TEST_ENV ];then
    source ./common/TEST_ENV
fi

check_rms
rm=$RESOURCE_MANAGER

PKG="R"


@test "[$PKG] Running Rscript bench.R under resource manager ($rm/$LMOD_FAMILY_COMPILER)" {
    test="bench"

    echo $test.R 
    if [ ! -e $test.R ];then
        flunk "$test.R does not exist"
    fi

    rm -f $test.results

    run run_serial_binary -t "00:04:00" -o $test.results Rscript ./$test.R 
    assert_success

    # Verify a timing was recorded
    # run grep "Total time" $test.results 
    # Verify run results are available
    run grep "loess n=4" $test.results 
    assert_success

}


